package com.imooc.spark

import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.sql.hive.HiveContext

/**
  * Created by zghgchao 2017/12/22 13:36
  *  HiveContext的使用
  */
object HiveContextApp {

  def main(args: Array[String]): Unit = {
    //1)创建相应的Context
    val sparkConf = new SparkConf()
    //      .setMaster("local[2]").setAppName("SparkContextApp")
    val sc = new SparkContext(sparkConf)
    //Spark 1.x中HiveContext入口
    val hiveContext = new HiveContext(sc)

    //2)相关业务处理
    hiveContext.table("emp").show()

    //3）关闭资源
    sc.stop()
  }

}
